﻿<!DOCTYPE HTML>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
<meta charset="utf-8">
<link th:href="@{/static/after/static/h-ui/css/H-ui.min.css}" rel="stylesheet" type="text/css" />
<link th:href="@{/static/after/static/h-ui.admin/css/H-ui.login.css}" rel="stylesheet" type="text/css" />
<link th:href="@{/static/after/static/h-ui.admin/css/style.css}" rel="stylesheet" type="text/css" />
<link th:href="@{/static/after/lib/Hui-iconfont/1.0.8/iconfont.css}" rel="stylesheet" type="text/css" />
<title>后台登录 - 智能家居 v1.1</title>
<style>
	.logos{
		background-color: rgba(100,100,100,0.5); 
		height: 70px; width: 100%; 
		position: absolute;top: 20px;
		text-align: left;
		font-family: "华文彩云";
		font-size: 35px;
		color: white;
		
	}

</style>
  <script src="../../static/after/JS/jquery-3.4.1.min.js"></script>
</head>
<body>
	
<div class="loginWraper">	
	<div class="logos" ><strong>智能家居 v1.1- 后台管理系统</strong></div>
  <div id="loginform" class="loginBox">
    <form class="form form-horizontal" action="/afters/login" method="post">
      <div class="row cl">
        <label class="form-label col-xs-3"><i class="Hui-iconfont">&#xe60d;</i></label>
        <div class="formControls col-xs-8">
          <input id="userName" name="userName" type="text" placeholder="账户" class="input-text size-L">
          <span id="usernameVal"></span>
        </div>
      </div>
      <div class="row cl">
        <label class="form-label col-xs-3"><i class="Hui-iconfont">&#xe60e;</i></label>
        <div class="formControls col-xs-8">
          <input id="passwordes" name="passwordes" type="password" placeholder="密码" class="input-text size-L">
          <span id="pwdVal"></span>
        </div>
      </div>
      <div class="row cl">
        <div class="formControls col-xs-8 col-xs-offset-3">
          <button name="" type="submit" class="btn btn-success radius size-L"  >登陆</button>
          <input name="" type="reset" class="btn btn-default radius size-L" value="&nbsp;取&nbsp;&nbsp;&nbsp;&nbsp;消&nbsp;">
        </div>
      </div>
    </form>
  </div>
</div>
<div class="footer">Copyright BD23 2组 by 智能家居 v1.1</div>
</body>

<script>
    /*鼠标获取焦点时*/
    $(document).ready(function () {
        var flag = false;
        var flag1 = false;

        $("#userName").focus(function () {
            $("#usernameVal").empty()
        })
        $("#passwordes").focus(function () {
            $("#pwdVal").empty()
        })

        /* 离开鼠标焦点时，激发表单验证*/
        //失去密码焦点时
        $("#passwordes").blur(function () {
            pwds();
        })

        function pwds() {
            //获取用户输入密码
            var pwd = $("#passwordes").val();
            if (pwd == null || pwd == "") {
                $("#pwdVal").html("密码不能为空").css("color", "red ");

            } else if (pwd.length < 6) {
                $("#pwdVal").html("密码长度不能小于6").css("color", "red ");
            } else {

                return flag1 = true;
            }
        }

        $("#userName").blur(function () {
            phone();
        })

        function phone() {
            var phone = $("#userName").val();
            if (phone == null || phone == "") {
                $("#usernameVal").html("账户不能为空").css("color", "red ");

            }
                return flag2 = true;

        }




        /**
         * 提交表单 当表单验证成功后提交
         */

        $(".btn btn-success radius size-L").click(function () {
            if(flag1==false){
                $("#pwdVal").html("密码不正确").css("color", "red ");
            }
            if(flag2==false){
                $("#usernameVal").html("用户名不正确").css("color", "red ");
            }

                $(".form form-horizontal").submit();


        })




    })

</script>


